package com.tang.springboot_condition.Userconfig;

import com.tang.springboot_condition.condition.Classcondition;
import com.tang.springboot_condition.domain.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
/*
* 这是一个配置类
* */
@Configuration
public class userconfig {

    /*
    将方法的返回值放置spring容器中
    * */
    @Bean
    @Conditional(Classcondition.class) // //返回true,spring会自动帮我们实例化对选象
    public User user(){
        return new User();
    }
}
